package com.cheng.xbsc.controller;

import com.cheng.xbsc.entity.vo.Result;
import com.cheng.xbsc.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/home")
public class HomeController {

    @Autowired
    private HomeService homeService;

    /**
     * 最新商品
     *
     * @return
     */
    @GetMapping("/findNewGoods")
    public Result findNewGoods() {
        return new Result(true, "查询成功", homeService.findNewGoods());
    }

    /**
     * 热卖商品
     *
     * @return
     */
    @GetMapping("/findHotGoods")
    public Result findHotGoods() {
        return new Result(true, "查询成功", homeService.findHotGoods());
    }

    /**
     * 查询所有列表
     */
    @GetMapping("/findAllProduct")
    public Result findAllProduct() {
        return new Result(true, "查询成功", homeService.findAllProduct());
    }
}
